package com.jiang.vo;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * MemberBasic entity. @author MyEclipse Persistence Tools
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "member_basic", catalog = "mldn")

public class MemberBasic implements java.io.Serializable {

	// Fields

	private String mid;
	private String name;
	private MemberDetails memberDetails;

	// Constructors

	/** default constructor */
	public MemberBasic() {
	}

	/** minimal constructor */
	public MemberBasic(String mid) {
		this.mid = mid;
	}

	/** full constructor */
	public MemberBasic(String mid, String name, MemberDetails memberDetails) {
		this.mid = mid;
		this.name = name;
		this.memberDetails = memberDetails;
	}

	// Property accessors
	@Id
	@Column(name = "mid", unique = true, nullable = false, length = 50)

	public String getMid() {
		return this.mid;
	}

	public void setMid(String mid) {
		this.mid = mid;
	}

	@Column(name = "name", length = 50)

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	// 这里配置一对一的双向关系，Lazy不是延迟加载，注解中配置代表是select 如果是eager是代表join
	@OneToOne(fetch = FetchType.LAZY, mappedBy = "memberBasic", cascade=CascadeType.ALL)
	public MemberDetails getMemberDetails() {
		return this.memberDetails;
	}

	public void setMemberDetails(MemberDetails memberDetails) {
		this.memberDetails = memberDetails;
	}

}